package LCR;

import java.util.HashMap;
import java.util.Map;

public class singleNumber {
    public int singleNumber(int[] nums) {
        Map<Integer,Integer> freq = new HashMap<Integer,Integer>();
        for(int num : nums) {
            freq.put(num,freq.getOrDefault(num,0)+1);
        }
        int ans = 0;
        for (Map.Entry<Integer, Integer> x:
        freq.entrySet()){
            int num = x.getKey(),occ = x.getValue();
            if(occ == 1) {
                ans = num;
                break;
            }

        }

        return ans;
    }


}
